﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        public static bool findnum(int  n)
        {
            if (n == 1)
            {
                return false;
            }
            for(int i = 2; i < n; i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一个数：");
            int a = Convert.ToInt32(Console.ReadLine());
            int[] num = new int[500];
            int b = 0;
            for (int i = 1; i <= a; i++)
            {
                if (a % i == 0)
                {
                    num[b] = i;
                    b = b + 1;
                }
            }
            int j = 0;
            bool isnum;
            int[] flag = new int[500];
            int m = 0;
            while (j < b)
            {
                isnum = findnum(num[j]);
                if (isnum)
                {
                    flag[m] = num[j];
                    m = m + 1;
                }
                j++;
            }
            for (int h = 0; h < m; h++)
            { Console.WriteLine(flag[h]);
                
            }
            Console.ReadKey();

        }
    }
}
